<template>
	<el-carousel height="120px">
      <el-carousel-item v-for="item in state.bannerList" :key="item.bannerId">
        <el-image style="width: 100%; height: 120px" :src="item.videoImg ? item.videoImg: item.url" :zoom-rate="1.2" fit="fill" />
      </el-carousel-item>
    </el-carousel>
</template>

<script lang="ts" setup name="bannerPage">
import { getFileSignParams } from '@/utils/signatureUtil';
const VITE_APP_ID = import.meta.env.VITE_APP_ID as string;
//------------------接收传入参数(组件)-------------------
const props = defineProps({
	bannerType: {
		type: String,
        default:'index'
	},
});
//------------------定义子组件---------------------------

//------------------内部变量定义-------------------------
const state = reactive({
	bannerList: [],
});

//------------------定义调用方法-------------------------
const getBannerList=()=>{
		//获取轮播图
		let params :any={appId:VITE_APP_ID}
		params.bannerType = props.bannerType;
		$api.common.send.post("banner0007",params).then((res :any)=>{
			if(res.result&&res.result.length>0){
				let list=[]
				res.result.forEach(element => {
					if(element.url){
						element.url=element.url+getFileSignParams()
					}
					if(element.videoImg){
						element.videoImg=element.videoImg+getFileSignParams()
					}
					list.push(element);
				});
				state.bannerList=list;
			}
			
		})
	}
    //-------------------------初始化-----------------------------
onMounted(() => {
	nextTick(() => {
		getBannerList();
	});
});
</script>
<style scoped lang="scss">

</style>